package ldk.easytouch.example.menus;

import android.graphics.drawable.Drawable;

import ldk.easytouch.example.interfaces.IMenuItem;
import ldk.easytouch.utils.ETLog;

/**
 * Created by ke on 16-9-16.
 */
public abstract class AbstractMenuItem implements IMenuItem{
    @SuppressWarnings("unused")
    private static final String TAG = "AbstractMenuItem";

    public static final int MENU_ITEM_SIZE = 30;

    private String mName;
    private Drawable mIcon;

    public AbstractMenuItem(String name){
        mName = name;
    }
    @Override
    public String name() {
        return mName;
    }

    @Override
    public Drawable icon() {
        if(mIcon == null){
            mIcon = generateIcon();
        }
        return mIcon;
    }

    protected abstract Drawable generateIcon();

    @Override
    public void onSingleTapConfirmed() {
        ETLog.v(TAG, "onSingleTapConfirmed");
    }

    @Override
    public boolean onLongPressed() {
        ETLog.v(TAG, "onLongPressed");
        return false;
    }

    @Override
    public void onDoubleClick() {
        ETLog.v(TAG, "onDoubleClick");
    }

    @Override
    public boolean canDelete() {
        return true;
    }
}
